home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / LIB / MENU_ITE.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.6 KB  |  91 lines

  1. package sub_arctic.lib;
  2. import sub_arctic.input.*;
  3.  
  4. /**
  5.  * This is the superclass for all objects which can be put on a 
  6.  * menu and understand the highlighting behavior.  (Other interactors can
  7.  * be placed in a menu, they just won't highlight.)
  8.  * @author Ian Smith
  9.  */
  10. public class menu_item extends base_interactor {
  11.  
  12.   // this behavior should really be defined in an interface
  13.  
  14.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  15.  
  16.   /**
  17.    * State of the object
  18.    */
  19.   boolean _highlighted;
  20.  
  21.   /**
  22.    * Query the state of the highlighting.
  23.    * @return boolean true if this object is currently highlighted
  24.    */
  25.   boolean highlighted() { return _highlighted;};
  26.  
  27.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  28.  
  29.   /**
  30.    * This is called to make this object highlight.
  31.    * @param event evt the event that caused us to be highlighted
  32.    */
  33.   public void highlight(event evt)  {
  34.     _highlighted=true;
  35.     /* we do this so subclasses with simple drawing behavior 
  36.        can just test the highlighted() value and redraw */
  37.     damage_self(); 
  38.   }
  39.  
  40.    //had:
  41.    //* @exception general PROPAGATED
  42.  
  43.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  44.  
  45.   /**
  46.    * This is called to make this object unhighlight.
  47.    * @param event evt the event that caused us to be unhighlighted
  48.    */
  49.   public void unhighlight(event evt) {
  50.     _highlighted=false;
  51.     /* we do this so subclasses with simple drawing behavior 
  52.        can just test the highlighted() value and redraw */
  53.     damage_self();
  54.   }
  55.  
  56.    //had:
  57.    //* @exception general PROPAGATED
  58.  
  59.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  60.  
  61.   /**
  62.    * We don't force a width or height on you here... we assume
  63.    * you are going to be a menu which will force the issue. 
  64.    */
  65.   public menu_item() {
  66.     super(0,0);
  67.     _highlighted=false;
  68.   }
  69.  
  70.    //had:
  71.    //* @exception general PROPAGATED
  72.  
  73.   /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
  74. }
  75. /*=========================== COPYRIGHT NOTICE ===========================
  76.  
  77. This file is part of the subArctic user interface toolkit.
  78.  
  79. Copyright (c) 1996 Scott Hudson and Ian Smith
  80. All rights reserved.
  81.  
  82. The subArctic system is freely available for most uses under the terms
  83. and conditions described in 
  84.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  85. and appearing in full in the lib/interactor.java source file.
  86.  
  87. The current release and additional information about this software can be 
  88. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  89.  
  90. ========================================================================*/
  91.